#include <stdio.h>
#include <string.h>

#define N 4
int main()
{
	int k = 0;
	char num[N] = {'0', '0', '0', '0'};

	while (1) {
		int i, flag;
		for (i = 0, flag = 0; i < N; i++) {
			if (num[i] != '0')
				flag = 1;
			if (flag == 1)
				printf("%c", num[i]);
		}
		printf("\n");
		
		k = N - 1;
		while (k >= 0)  {
			if (num[k] + 1 <= '9') {
				num[k]++;
				break;
			} else {
				num[k] = '0';
				k--;
			}
		}
		if (k < 0)
			break;
	}
	return 0;
}
